/**
 * 
 */
package org.lex.ftp.util.bookmark;

import org.lex.net.Password;
import org.lex.net.ftp.FTPURL;

public class Site implements java.io.Serializable {
	private static final long serialVersionUID = -7499746713789088794L;
	private String name = null;
	private String userName = null;
	private String password = null;
	private String host = null;
	private int port = 21;
	private String path = null;

	public Site() {
	}

	public Site(String name, FTPURL url) {
		this.name = name;
		this.setURL(url);
	}

	public FTPURL getURL() {
		return new FTPURL(new Password(userName, password.toCharArray()), host, port, path);
	}

	public void setURL(FTPURL url) {
		this.userName = url.getAuthentication().getUserName();
		this.password = String.valueOf(url.getAuthentication().getPassword());
		this.host = url.getHost();
		this.port = url.getPort();
		this.path = url.getPath();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String user) {
		this.userName = user;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String toString() {
		return this.name;
	}
}
